﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Data;

namespace ITD_VAPCF.NganQuy.ORTHER
{
    public static class NQFunction
    {
        public static string Get_Valid_KhachHang(string _Ten_Valid, out string _Ma_Out, out string _ID_Out, out DataRow rowsTT)
        {
            string _ID = "";
            string _Ma = "";
            string _Ten = "";
            DataRow rowOut = null;
            try
            {
                {
                    ////Kiem tra trong CSDL da co chua
                    DataRow[] rows = CommonTable.dtKhach_Hang.Select("(ten LIKE '" + _Ten_Valid + "%')");
                    {
                        GlobalVars.frmSelectKhachTV.TK_Input = _Ten_Valid;
                        GlobalVars.frmSelectKhachTV.ShowDialog();
                        GlobalVars.frmSelectKhachTV.SuccessFull(out _ID, out _Ma, out _Ten);
                        if (_ID != "")
                            rows = CommonTable.dtKhach_Hang.Select("(KhachHang_ID = '" + _ID + "')");
                        rowOut = rows[0];
                    }
                }

            }
            catch (Exception ex)
            {
                Common.Messages.ShowError(ex.ToString());
            }

            _ID_Out = _ID;
            _Ma_Out = _Ma;
            rowsTT = rowOut;
            return _Ten;
        }
    }
}
